﻿using System.Collections.Generic;
using System.Linq;
namespace Mal.Balades.Admin.ViewModels.VisitViewModels.Dashboard
{
    public class DashboardFilterValidViewModel : DashboardFilterViewModel
    {
        #region Fields
        private List<VisitDashboardViewModel> visits;
        #endregion

        #region Construction / Destruction
        public DashboardFilterValidViewModel(VisitsDashBoardViewModel parent, bool visitsValid)
            : base(parent)
        {
            visits = this.Parent.Visits.Where(v => v.IsValid == visitsValid).ToList();
            this.Count = visits.Count;

            if (visitsValid)
                this.Label = "valides";
            else
                this.Label = "invalides";
        }
        #endregion

        #region enum, struct, class

        #endregion

        #region Properties

        #endregion

        #region Methods
        public override bool Filter(object obj)
        {
            VisitDashboardViewModel visit = obj as VisitDashboardViewModel;

            if (!this.visits.Contains(visit))
                return false;

            return base.Filter(obj);
        }
        #endregion

        #region Events

        #endregion


    }
}
